module.exports = function($scope, $state, $stateParams, $modalInstance, items, $resource){
   

    $scope.item=items;
    $scope.obj={};
    $scope.bording_locations = [{ CODE:"0",NAME:"未选择"}];
    $scope.bording_location = '0';
    $scope.bording_location1 = '0';
    
     $resource('/api/as/sc/office/officeList', {}, {})
        .get( function (res) {
            // console.log('下面是上车地点');
            //console.log(res);
            // console.log('上面是上车地点');
            
            if (res.errcode == 0) {
            // $scope.bording_locations = [{ CODE:"0",NAME:"未选择"}];
            var arrtuijian = res.data; 
            for(i=0;i<arrtuijian.length;i++){               
                $scope.bording_locations.push({CODE :arrtuijian[i].code , NAME: arrtuijian[i].name});           
            }
                

            } else {
                alert(res.errmsg);
            }
        });
       
    $scope.cancel = function () {  
        $modalInstance.dismiss('cancel'); 
    };
    $scope.gogogo = function () {
        if($scope.messageinfo.$valid){
            //alert('通过验证可以提交表单');
        }else{
            //alert('表单没有通过验证');
            return;
        }
        
        $scope.obj['seller_code']=$scope.bording_location;
        $scope.obj['save_type']=$scope.bording_location1;
        
       
        $resource('/api/ac/pc/payBmAccountService/insertPayAccount', {}, {}).save($scope.obj, function(res){
            // console.log(res);
            if(res.errcode === 0){
                $modalInstance.close($scope.result);
                alert('保存成功');
            }else{
                alert(res.errmsg);
            }
        });
    };
};